using System; 
using UnityEngine;
using UnityEngine.Events;


namespace XFGameFramework.CommonSystem
{ 
    [Serializable]
    public class AnimationEvent : UnityEvent<string> { }

    /// <summary>
    /// 监听Animator事件
    /// </summary>
    public class AnimationEventListener : MonoBehaviour
    { 
        /// <summary>
        /// 触发Animator事件时调用
        /// </summary>
        public AnimationEvent onAnimationEvent = new AnimationEvent();

        /// <summary>
        /// 动画事件方法,可在Animation中绑定该方法
        /// </summary>
        /// <param name="name"></param>
        public void OnAnimationEvent(string name) {
            onAnimationEvent?.Invoke(name);
        } 
    }
}

